package Java实训.第六天File文件和IO流;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Num2 {
    /*
    * 使用字符流分别实现把你心目中几个男神或女神的名字换行写到一个文本文件中。
    * */
    public static void main(String[] args) {
        FileWriter fw = null;
        try {
            fw = new FileWriter("C:\\Users\\gdq\\OneDrive\\桌面\\File文件夹\\Num2.txt");
            fw.write("高代起");
            fw.write("\n");
            fw.write("韩瑞杰");
            fw.write("\n");
            fw.write("李柘宏");
            fw.write("\n");
            fw.write("李东键");
            fw.write("\n");
            fw.write("史乃齐");
            fw.write("\n");
            fw.write("郭昊");
            fw.write("\n");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fw!=null){
                try {
                    fw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                fw = null;
            }

        }

    }
}
